var PeopleMedia = PeopleMedia || {};
PeopleMedia.Theming = PeopleMedia.Theming || {};
PeopleMedia.Theming.CurrentTheme = '';
PeopleMedia.Theming.CustomCode = PeopleMedia.Theming.CustomCode || {};
PeopleMedia.Theming.ApplyTheme = function (theme) {
    try {
        if (PeopleMedia.Theming.CurrentTheme == theme) return;
        PeopleMedia.Theming.CurrentTheme = theme;
        var topFrame = window != window.parent ? window.parent : window;
        if (topFrame == null) return;

        var body = jQuery('body', topFrame.document);
        theme = theme.toLowerCase();
        body.addClass(theme);
        PeopleMedia.Theming.ThemeCustom(theme);
    }
    catch (ex) {
        var themeName = theme || "Unknown Theme";
        PeopleMedia.Logger.LogExceptionWithDetail(ex, "Error applying theme: " + themeName);
    }
};
PeopleMedia.Theming.ThemeCustom = function (theme) {
    var fn = PeopleMedia.Theming.CustomCode[theme];
    if (typeof fn === 'function') {
        fn();
    }
};
PeopleMedia.Theming.CustomCode.crest = function () {
    //Any custom code goes here.
    alert('crested');
};